package jp.co.piratealliance.pirateAllianceWeb.web.action.com;

import jp.co.piratealliance.pirateAllianceWeb.common.base.BaseAction;
import jp.co.piratealliance.pirateAllianceWeb.dto.com.UserLanguageInfoDto;
import jp.co.piratealliance.pirateAllianceWeb.service.com.UserService;

/**
 * copyright pirate alliance team 2014
 *
 * @author lunxing
 */

public class UserLanguageInfoAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private UserService userService;

	private UserLanguageInfoDto userLanguageInfoDto;
	
	private String user_id;
	
	private String language_id;

	public String selectUserLanguageByUserIdAndLanguageId()
	{
		this.userLanguageInfoDto = this.userService.selectUserLanguageByUserIdAndLanguageId(this.user_id, this.language_id);
		return SUCCESS;
	}
	
	public String insertUserLanguage()
	{
		int count = this.userService.insertUserLanguage(this.userLanguageInfoDto);
		
		if (1 != count) {
			this.userLanguageInfoDto = null;
		}
		
		return SUCCESS;
	}
	
	public String updateUserLanguage()
	{
		int count = this.userService.updateUserLanguage(this.userLanguageInfoDto);
		
		if (1 != count) {
			this.userLanguageInfoDto = null;
		}
		
		return SUCCESS;
	}

	/**
	 * @return the userService
	 */
	public UserService getUserService() {
		return userService;
	}

	/**
	 * @param userService the userService to set
	 */
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	/**
	 * @return the userLanguageInfoDto
	 */
	public UserLanguageInfoDto getUserLanguageInfoDto() {
		return userLanguageInfoDto;
	}

	/**
	 * @param userLanguageInfoDto the userLanguageInfoDto to set
	 */
	public void setUserLanguageInfoDto(UserLanguageInfoDto userLanguageInfoDto) {
		this.userLanguageInfoDto = userLanguageInfoDto;
	}

	/**
	 * @return the user_id
	 */
	public String getUser_id() {
		return user_id;
	}

	/**
	 * @param user_id the user_id to set
	 */
	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}

	/**
	 * @return the language_id
	 */
	public String getLanguage_id() {
		return language_id;
	}

	/**
	 * @param language_id the language_id to set
	 */
	public void setLanguage_id(String language_id) {
		this.language_id = language_id;
	}

}
